<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.2">


  <link rel="apple-touch-icon" sizes="180x180" href="/page/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/page/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/page/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/page/images/logo.svg" color="#222">

<link rel="stylesheet" href="/page/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css" integrity="sha256-mUZM63G8m73Mcidfrv5E+Y61y7a12O5mW4ezU3bxqW4=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"assd12138.gitee.io","root":"/page/","images":"/page/images","scheme":"Gemini","darkmode":false,"version":"8.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/page/search.json","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/page/js/config.js"></script>
<meta name="description" content="收集各类笔试题">
<meta property="og:type" content="article">
<meta property="og:title" content="笔试题汇总">
<meta property="og:url" content="https://assd12138.gitee.io/page/2020/09/11/%E7%AC%94%E8%AF%95%E9%A2%98%E6%B1%87%E6%80%BB/index.html">
<meta property="og:site_name" content="爱爱爱呵风他">
<meta property="og:description" content="收集各类笔试题">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-09-11T06:05:39.000Z">
<meta property="article:modified_time" content="2022-05-09T03:18:13.064Z">
<meta property="article:author" content="爱爱爱呵风他">
<meta property="article:tag" content="笔试题">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="https://assd12138.gitee.io/page/2020/09/11/%E7%AC%94%E8%AF%95%E9%A2%98%E6%B1%87%E6%80%BB/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://assd12138.gitee.io/page/2020/09/11/%E7%AC%94%E8%AF%95%E9%A2%98%E6%B1%87%E6%80%BB/","path":"2020/09/11/笔试题汇总/","title":"笔试题汇总"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>笔试题汇总 | 爱爱爱呵风他</title>
  




  <noscript>
    <link rel="stylesheet" href="/page/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/page/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">爱爱爱呵风他</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/page/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-tags"><a href="/page/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li>
        <li class="menu-item menu-item-archives"><a href="/page/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#web%E5%BC%80%E5%8F%91%E4%B8%AD%E4%BC%9A%E8%AF%9D%E8%B7%9F%E8%B8%AA%E7%9A%84%E6%96%B9%E6%B3%95%E6%9C%89%E5%93%AA%E4%BA%9B"><span class="nav-number">1.</span> <span class="nav-text">web开发中会话跟踪的方法有哪些</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#HTTP-methods"><span class="nav-number">2.</span> <span class="nav-text">HTTP methods</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BB%8E%E6%B5%8F%E8%A7%88%E5%99%A8%E5%9C%B0%E5%9D%80%E8%BE%93%E5%85%A5url%E5%88%B0%E6%98%BE%E7%A4%BA%E9%A1%B5%E9%9D%A2%E7%9A%84%E6%AD%A5%E9%AA%A4"><span class="nav-number">3.</span> <span class="nav-text">从浏览器地址输入url到显示页面的步骤</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%A6%82%E4%BD%95%E8%BF%9B%E8%A1%8C%E7%BD%91%E7%AB%99%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96"><span class="nav-number">4.</span> <span class="nav-text">如何进行网站性能优化</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E7%BD%91%E7%BB%9C%E8%AF%B7%E6%B1%82%E4%BC%98%E5%8C%96"><span class="nav-number">4.1.</span> <span class="nav-text">网络请求优化</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#%E7%BC%93%E5%AD%98"><span class="nav-number">4.1.1.</span> <span class="nav-text">缓存</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E8%B5%84%E6%BA%90%E6%89%93%E5%8C%85%E5%8E%8B%E7%BC%A9"><span class="nav-number">4.1.2.</span> <span class="nav-text">资源打包压缩</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E4%BD%BF%E7%94%A8CDN"><span class="nav-number">4.1.3.</span> <span class="nav-text">使用CDN</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E9%A1%B5%E9%9D%A2%E6%B8%B2%E6%9F%93%E4%BC%98%E5%8C%96"><span class="nav-number">4.2.</span> <span class="nav-text">页面渲染优化</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#JS%E6%80%A7%E8%83%BD"><span class="nav-number">4.3.</span> <span class="nav-text">JS性能</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#http%E6%9C%89%E5%93%AA%E4%BA%9B%E5%AD%97%E6%AE%B5"><span class="nav-number">5.</span> <span class="nav-text">http有哪些字段</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E8%AF%B7%E6%B1%82%E5%A4%B4"><span class="nav-number">5.1.</span> <span class="nav-text">请求头</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%93%8D%E5%BA%94%E5%A4%B4"><span class="nav-number">5.2.</span> <span class="nav-text">响应头</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%B8%85%E9%99%A4%E6%B5%AE%E5%8A%A8"><span class="nav-number">6.</span> <span class="nav-text">清除浮动</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%9E%82%E7%9B%B4%E5%B1%85%E4%B8%AD"><span class="nav-number">7.</span> <span class="nav-text">垂直居中</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E4%BC%A0%E7%BB%9F%E6%96%B9%E5%BC%8F"><span class="nav-number">7.1.</span> <span class="nav-text">传统方式</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#CSS3%E6%96%B9%E5%BC%8F"><span class="nav-number">7.2.</span> <span class="nav-text">CSS3方式</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%87%8D%E7%BB%98%E5%92%8C%E9%87%8D%E6%8E%92"><span class="nav-number">8.</span> <span class="nav-text">重绘和重排</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#png-gif-jpg%E5%9C%A8web%E4%B8%AD%E7%9A%84%E5%BA%94%E7%94%A8"><span class="nav-number">9.</span> <span class="nav-text">png&#x2F;gif&#x2F;jpg在web中的应用</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#JavaScript%E8%B7%A8%E5%9F%9F%E9%97%AE%E9%A2%98"><span class="nav-number">10.</span> <span class="nav-text">JavaScript跨域问题</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AF%B9%E8%B1%A1%E5%88%B0%E5%AD%97%E7%AC%A6%E4%B8%B2%E7%9A%84%E8%BD%AC%E6%8D%A2%E6%AD%A5%E9%AA%A4"><span class="nav-number">11.</span> <span class="nav-text">对象到字符串的转换步骤</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%87%BD%E6%95%B0%E5%86%85%E9%83%A8%E7%9A%84-arguments-%E5%8F%98%E9%87%8F"><span class="nav-number">12.</span> <span class="nav-text">函数内部的 arguments 变量</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#focus-blur-%E4%B8%8E-focusin-focusout-%E7%9A%84%E5%8C%BA%E5%88%AB%E4%B8%8E%E8%81%94%E7%B3%BB"><span class="nav-number">13.</span> <span class="nav-text">focus&#x2F;blur 与 focusin&#x2F;focusout 的区别与联系</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#sessionStorage-%EF%BC%8ClocalStorage%EF%BC%8C-cookie-%E5%8C%BA%E5%88%AB"><span class="nav-number">14.</span> <span class="nav-text">sessionStorage ，localStorage， cookie 区别</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#JavaScript-%E6%9C%89%E5%93%AA%E5%87%A0%E7%A7%8D%E6%96%B9%E6%B3%95%E5%AE%9A%E4%B9%89%E5%87%BD%E6%95%B0"><span class="nav-number">15.</span> <span class="nav-text">JavaScript 有哪几种方法定义函数</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BB%80%E4%B9%88%E6%98%AF%E9%97%AD%E5%8C%85%EF%BC%8C%E9%97%AD%E5%8C%85%E6%9C%89%E4%BB%80%E4%B9%88%E7%94%A8"><span class="nav-number">16.</span> <span class="nav-text">什么是闭包，闭包有什么用</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#let-%E4%B8%8E-var-%E7%9A%84%E5%8C%BA%E5%88%AB%EF%BC%8C%E4%BB%A5%E5%8F%8A-%E7%AE%AD%E5%A4%B4%E5%87%BD%E6%95%B0-%E4%B8%8E-function-%E7%9A%84%E5%8C%BA%E5%88%AB"><span class="nav-number">17.</span> <span class="nav-text">let 与 var 的区别，以及 箭头函数 与 function 的区别</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#10%E4%B8%AA%E8%A1%8C%E5%86%85%E5%85%83%E7%B4%A0%EF%BC%8C10%E4%B8%AA%E5%9D%97%E7%8A%B6%E5%85%83%E7%B4%A0%EF%BC%8C10%E7%A7%8D%E9%80%89%E6%8B%A9%E5%99%A8"><span class="nav-number">18.</span> <span class="nav-text">10个行内元素，10个块状元素，10种选择器</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%9B%92%E6%A8%A1%E5%9E%8B%E6%9C%89%E5%93%AA%E4%BA%9B"><span class="nav-number">19.</span> <span class="nav-text">盒模型有哪些</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#W3C%E6%A0%87%E5%87%86%E7%9B%92%E6%A8%A1%E5%9E%8B"><span class="nav-number">19.1.</span> <span class="nav-text">W3C标准盒模型</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#IE%E6%80%AA%E5%BC%82%E7%9B%92%E6%A8%A1%E5%9E%8B"><span class="nav-number">19.2.</span> <span class="nav-text">IE怪异盒模型</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#for%E2%80%A6in%E5%92%8Cfor%E2%80%A6of%E6%9C%89%E4%BB%80%E4%B9%88%E5%8C%BA%E5%88%AB"><span class="nav-number">20.</span> <span class="nav-text">for…in和for…of有什么区别</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#for%E2%80%A6in"><span class="nav-number">20.1.</span> <span class="nav-text">for…in</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#for%E2%80%A6of"><span class="nav-number">20.2.</span> <span class="nav-text">for…of</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#js%E5%93%AA%E4%BA%9B%E6%96%B9%E6%B3%95%E4%BC%9A%E6%94%B9%E5%8F%98%E5%8E%9F%E6%95%B0%E7%BB%84-%E5%8E%9F%E5%AD%97%E7%AC%A6%E4%B8%B2"><span class="nav-number">21.</span> <span class="nav-text">js哪些方法会改变原数组&#x2F;原字符串</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="爱爱爱呵风他"
      src="https://s1.ax1x.com/2020/08/26/dWnF58.jpg">
  <p class="site-author-name" itemprop="name">爱爱爱呵风他</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/page/archives/">
          <span class="site-state-item-count">24</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/page/tags/">
        <span class="site-state-item-count">11</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="cc-license site-overview-item animated" itemprop="license">
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/zh-cn" class="cc-opacity" rel="noopener" target="_blank"><img src="https://cdn.jsdelivr.net/npm/@creativecommons/vocabulary@2020.11.3/assets/license_badges/small/by_nc_sa.svg" alt="Creative Commons"></a>
  </div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://assd12138.gitee.io/page/2020/09/11/%E7%AC%94%E8%AF%95%E9%A2%98%E6%B1%87%E6%80%BB/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="https://s1.ax1x.com/2020/08/26/dWnF58.jpg">
      <meta itemprop="name" content="爱爱爱呵风他">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="爱爱爱呵风他">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          笔试题汇总
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2020-09-11 14:05:39" itemprop="dateCreated datePublished" datetime="2020-09-11T14:05:39+08:00">2020-09-11</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2022-05-09 11:18:13" itemprop="dateModified" datetime="2022-05-09T11:18:13+08:00">2022-05-09</time>
      </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <p>收集各类笔试题</p>
<span id="more"></span>

<h3 id="web开发中会话跟踪的方法有哪些"><a href="#web开发中会话跟踪的方法有哪些" class="headerlink" title="web开发中会话跟踪的方法有哪些"></a>web开发中会话跟踪的方法有哪些</h3><p>后端session+前端cookie、url重写、隐藏表单域</p>
<h3 id="HTTP-methods"><a href="#HTTP-methods" class="headerlink" title="HTTP methods"></a>HTTP methods</h3><p>GET/POST/PUT/DELETE/HEAD</p>
<h3 id="从浏览器地址输入url到显示页面的步骤"><a href="#从浏览器地址输入url到显示页面的步骤" class="headerlink" title="从浏览器地址输入url到显示页面的步骤"></a>从浏览器地址输入url到显示页面的步骤</h3><p>查询DNS服务器-&gt;tcp三次握手-&gt;客户端发起http请求-&gt;浏览器解析渲染页面-&gt;TCP四次挥手</p>
<h3 id="如何进行网站性能优化"><a href="#如何进行网站性能优化" class="headerlink" title="如何进行网站性能优化"></a>如何进行网站性能优化</h3><h4 id="网络请求优化"><a href="#网络请求优化" class="headerlink" title="网络请求优化"></a>网络请求优化</h4><h5 id="缓存"><a href="#缓存" class="headerlink" title="缓存"></a>缓存</h5><p>使用cache-control(maxage)/expires(日期)字段的强缓存和Etag/Last-modified(服务器发给客户端时的称呼)、If-None-Match/If-Modified-Since(客户端发给服务器时的称呼)的协商缓存</p>
<h5 id="资源打包压缩"><a href="#资源打包压缩" class="headerlink" title="资源打包压缩"></a>资源打包压缩</h5><p>使用webpack对文件进行treeshake和压缩处理，服务器开启g-zip(图片除外)</p>
<h5 id="使用CDN"><a href="#使用CDN" class="headerlink" title="使用CDN"></a>使用CDN</h5><p>一些公共库或者静态资源文件可以依赖公共CDN或者购买CDN加速服务</p>
<h4 id="页面渲染优化"><a href="#页面渲染优化" class="headerlink" title="页面渲染优化"></a>页面渲染优化</h4><ol>
<li>减少重绘和重排</li>
<li>减少DOM的嵌套</li>
</ol>
<h4 id="JS性能"><a href="#JS性能" class="headerlink" title="JS性能"></a>JS性能</h4><ol>
<li>防抖和节流</li>
<li>SPA中进行切换页面时关闭掉一些资源</li>
</ol>
<h3 id="http有哪些字段"><a href="#http有哪些字段" class="headerlink" title="http有哪些字段"></a>http有哪些字段</h3><h4 id="请求头"><a href="#请求头" class="headerlink" title="请求头"></a>请求头</h4><table>
<thead>
<tr>
<th>字段</th>
<th>含义</th>
</tr>
</thead>
<tbody><tr>
<td>methods</td>
<td>GET/POST…</td>
</tr>
<tr>
<td>HOST</td>
<td>主机名</td>
</tr>
<tr>
<td>Accept-Encoding</td>
<td>编码方式（g-zip）</td>
</tr>
<tr>
<td>User-Agent</td>
<td>用户代理</td>
</tr>
</tbody></table>
<h4 id="响应头"><a href="#响应头" class="headerlink" title="响应头"></a>响应头</h4><table>
<thead>
<tr>
<th>响应码</th>
<th>含义</th>
</tr>
</thead>
<tbody><tr>
<td>2xx</td>
<td>成功</td>
</tr>
<tr>
<td>3xx</td>
<td>重定向</td>
</tr>
<tr>
<td>4xx</td>
<td>请求错误</td>
</tr>
<tr>
<td>5xx</td>
<td>服务器错误</td>
</tr>
</tbody></table>
<table>
<thead>
<tr>
<th>字段</th>
<th>含义</th>
</tr>
</thead>
<tbody><tr>
<td>ContentType</td>
<td>返回类型（html/xml/）</td>
</tr>
<tr>
<td>Content-Length</td>
<td>响应体的长度</td>
</tr>
<tr>
<td>Access-Control-Allow-Origin</td>
<td>允许访问该资源的域/跨域问题</td>
</tr>
</tbody></table>
<h3 id="清除浮动"><a href="#清除浮动" class="headerlink" title="清除浮动"></a>清除浮动</h3><p>1.触发BFC<br>2.添加无意义空元素在后面，设置其clear:both<br>3.伪元素+IEhack</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">selector<span class="selector-pseudo">:after</span>&#123;</span><br><span class="line">  <span class="attribute">clear</span>:both</span><br><span class="line">&#125;</span><br><span class="line">selector&#123;</span><br><span class="line">  // IEhack</span><br><span class="line">  zoom:<span class="number">1</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>4.父元素也浮动起来（破坏布局）</p>
<h3 id="垂直居中"><a href="#垂直居中" class="headerlink" title="垂直居中"></a>垂直居中</h3><h4 id="传统方式"><a href="#传统方式" class="headerlink" title="传统方式"></a>传统方式</h4><ol>
<li>行内line-height设置为和其父元素一致</li>
<li>元素满足display:inline-block的情况下vertical-align:middle</li>
<li>绝对定位后设置元素margin:auto</li>
</ol>
<h4 id="CSS3方式"><a href="#CSS3方式" class="headerlink" title="CSS3方式"></a>CSS3方式</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.content</span>&#123;</span><br><span class="line">  <span class="attribute">display</span>:inline-block;</span><br><span class="line">  <span class="attribute">justify-content</span>: center;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="重绘和重排"><a href="#重绘和重排" class="headerlink" title="重绘和重排"></a>重绘和重排</h3><ol>
<li>重绘：元素的颜色、背景、盒阴影、下划线等展示属性被修改，没有改变布局</li>
<li>重排（或者叫回流）：元素的宽度、高度、内外边距、字体大小等和布局相关的属性发生变化、需要重新计算元素的集合属性，重新放置元素</li>
</ol>
<p>重排计算开销更加大，因此要减少重排范围，减少重排产生的次数，绝对脱离文档流的元素重排消耗较小</p>
<h3 id="png-gif-jpg在web中的应用"><a href="#png-gif-jpg在web中的应用" class="headerlink" title="png/gif/jpg在web中的应用"></a>png/gif/jpg在web中的应用</h3><table>
<thead>
<tr>
<th>格式</th>
<th>优点</th>
<th>缺点</th>
<th>适用场景</th>
</tr>
</thead>
<tbody><tr>
<td>gif</td>
<td>文件小，支持动画、透明，无兼容性问题</td>
<td>只支持256种颜色</td>
<td>色彩简单的logo、icon、动图</td>
</tr>
<tr>
<td>jpg</td>
<td>色彩丰富，文件小</td>
<td>有损压缩，反复保存图片质量下降明显</td>
<td>色彩丰富的图片/渐变图像</td>
</tr>
<tr>
<td>png</td>
<td>无损压缩，支持透明，简单图片尺寸小</td>
<td>不支持动画，色彩丰富的图片尺寸大</td>
<td>logo/icon/透明图</td>
</tr>
</tbody></table>
<h3 id="JavaScript跨域问题"><a href="#JavaScript跨域问题" class="headerlink" title="JavaScript跨域问题"></a>JavaScript跨域问题</h3><p>主要是Ajax请求</p>
<ol>
<li>使用jsonp标签bug进行跨域</li>
<li>使用CORS(跨域资源共享)，在服务器端进行控制</li>
<li>使用websocket通信协议</li>
</ol>
<h3 id="对象到字符串的转换步骤"><a href="#对象到字符串的转换步骤" class="headerlink" title="对象到字符串的转换步骤"></a>对象到字符串的转换步骤</h3><p>首先调用对象的toString()方法，如果无法获得一个基本类型值就再次调用valueOf()方法</p>
<h3 id="函数内部的-arguments-变量"><a href="#函数内部的-arguments-变量" class="headerlink" title="函数内部的 arguments 变量"></a>函数内部的 arguments 变量</h3><p>arguments变量是一个类数组，可以使用下标访问，并且和参数名访问到的值始终保持一致，也就是说这两个访问参数的方式会互相影响改变对方。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 参数的数量</span></span><br><span class="line"><span class="variable language_">arguments</span>.<span class="property">length</span></span><br><span class="line"><span class="comment">// 当前正在执行的函数</span></span><br><span class="line"><span class="variable language_">arguments</span>.<span class="title function_">callee</span>()</span><br><span class="line"><span class="comment">// 转换为真实数组</span></span><br><span class="line"><span class="keyword">let</span> args = [...<span class="variable language_">arguments</span>]</span><br></pre></td></tr></table></figure>

<h3 id="focus-blur-与-focusin-focusout-的区别与联系"><a href="#focus-blur-与-focusin-focusout-的区别与联系" class="headerlink" title="focus/blur 与 focusin/focusout 的区别与联系"></a>focus/blur 与 focusin/focusout 的区别与联系</h3><p>focus和blur不会冒泡，focusin和focusout会冒泡<br>当焦点从页面中的一个元素移动到另一个元素，会依次触发下列事件：</p>
<ol>
<li>focusout 在失去焦点的元素上触发</li>
<li>focusin 在获得焦点的元素上触发</li>
<li>blur 在失去焦点的元素上触发</li>
<li>focus 在获得焦点的元素上触发</li>
</ol>
<h3 id="sessionStorage-，localStorage，-cookie-区别"><a href="#sessionStorage-，localStorage，-cookie-区别" class="headerlink" title="sessionStorage ，localStorage， cookie 区别"></a>sessionStorage ，localStorage， cookie 区别</h3><table>
<thead>
<tr>
<th>特性</th>
<th>Cookie</th>
<th>localStorage</th>
<th>sessionStorage</th>
</tr>
</thead>
<tbody><tr>
<td>数据的生命期</td>
<td>一般由服务器生成，可设置失效时间。如果在浏览器端生成Cookie，默认是关闭浏览器后失效</td>
<td>除非被清除，否则永久保存</td>
<td>仅在当前会话下有效，关闭页面或浏览器后被清除</td>
</tr>
<tr>
<td>存放数据大小</td>
<td>4K左右</td>
<td>一般为5MB</td>
<td>同localStorage</td>
</tr>
<tr>
<td>与服务器端通信</td>
<td>每次都会携带在HTTP头中，如果使用cookie保存过多数据会带来性能问题</td>
<td>仅在客户端（即浏览器）中保存，不参与和服务器的通信</td>
<td>同localStorage</td>
</tr>
<tr>
<td>易用性</td>
<td>需要程序员自己封装，源生的Cookie接口不友好</td>
<td>源生接口可以接受，亦可再次封装来对Object和Array有更好的支持</td>
<td>同localStorage</td>
</tr>
</tbody></table>
<h3 id="JavaScript-有哪几种方法定义函数"><a href="#JavaScript-有哪几种方法定义函数" class="headerlink" title="JavaScript 有哪几种方法定义函数"></a>JavaScript 有哪几种方法定义函数</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> <span class="title function_">func1</span> = (<span class="params"></span>) =&gt; &#123;</span><br><span class="line">  ...</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">function</span> <span class="title function_">func2</span>(<span class="params"></span>)&#123;</span><br><span class="line">  ...</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// 没啥用的方法</span></span><br><span class="line"><span class="keyword">let</span> func3 = <span class="keyword">new</span> <span class="title class_">Function</span>(<span class="string">&quot;alert(&#x27;Hello world!&#x27;)&quot;</span>)</span><br></pre></td></tr></table></figure>

<h3 id="什么是闭包，闭包有什么用"><a href="#什么是闭包，闭包有什么用" class="headerlink" title="什么是闭包，闭包有什么用"></a>什么是闭包，闭包有什么用</h3><p>能够访问另一个函数命名空间的函数就是一种闭包，最常见的方式是在一个函数中创建另一个函数</p>
<ol>
<li>封装变量</li>
<li>闭包创建柯里化的函数</li>
<li>进行运算结果缓存</li>
<li>批量绑定事件函数（这里是避免闭包访问到同一变量，将闭包变量作为参数传入函数成为自己的局部变量）</li>
</ol>
<h3 id="let-与-var-的区别，以及-箭头函数-与-function-的区别"><a href="#let-与-var-的区别，以及-箭头函数-与-function-的区别" class="headerlink" title="let 与 var 的区别，以及 箭头函数 与 function 的区别"></a>let 与 var 的区别，以及 箭头函数 与 function 的区别</h3><p>let不存在变量提升，支持局部变量，如果在let定义前使用某变量会报Refference Error。而var不支持局部变量，并且会产生变量提升，在var定义前使用会报undefine</p>
<p>除非使用apply或者call或者bind进行修改，箭头函数的this为定义时所处的上下文，而function的this为调用时所处的上下文</p>
<h3 id="10个行内元素，10个块状元素，10种选择器"><a href="#10个行内元素，10个块状元素，10种选择器" class="headerlink" title="10个行内元素，10个块状元素，10种选择器"></a>10个行内元素，10个块状元素，10种选择器</h3><ol>
<li>行内span、img、input、a、label、button、select、textarea、sup、sub、abbr、s、i、em、u、strong、small</li>
<li>块状元素div、p、h1~h6、ul、li、ol、dd、dt、dl、table、hr、blockquote、address</li>
<li>HTML5中新增的语义化标签header、footer、aside、section也是块状元素<br>选择器:通配符选择器* 标签选择器div 属性选择器[] 伪类选择器: 类选择器. id选择器#<br>选择符：后代选择符空格（ ）、子选择符箭头（&gt;）、相邻兄弟选择符（+）、随后兄弟选择符弯弯（~）、列选择符双管道（||）</li>
</ol>
<h3 id="盒模型有哪些"><a href="#盒模型有哪些" class="headerlink" title="盒模型有哪些"></a>盒模型有哪些</h3><p>将box-sizing设置为content-box就是标准盒模型，border-box就是怪异盒模型</p>
<h4 id="W3C标准盒模型"><a href="#W3C标准盒模型" class="headerlink" title="W3C标准盒模型"></a>W3C标准盒模型</h4><p>标准盒设置的width就是内容的宽度，元素的总宽度是width+padding+border+margin</p>
<h4 id="IE怪异盒模型"><a href="#IE怪异盒模型" class="headerlink" title="IE怪异盒模型"></a>IE怪异盒模型</h4><p>怪异盒模型的width是内容+内边距+边框的宽度,元素的总宽度是width+margin</p>
<h3 id="for…in和for…of有什么区别"><a href="#for…in和for…of有什么区别" class="headerlink" title="for…in和for…of有什么区别"></a>for…in和for…of有什么区别</h3><h4 id="for…in"><a href="#for…in" class="headerlink" title="for…in"></a>for…in</h4><p>for…in是用来遍历一个对象中的非符号键属性</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> a = &#123;</span><br><span class="line">  <span class="attr">a</span>: <span class="number">1</span>,</span><br><span class="line">  <span class="attr">b</span>: <span class="number">2</span>,</span><br><span class="line">  [<span class="title class_">Symbol</span>(<span class="string">&#x27;c&#x27;</span>)]: <span class="number">3</span>,</span><br><span class="line">  <span class="attr">d</span>: <span class="literal">null</span>,</span><br><span class="line">  <span class="attr">e</span>: <span class="literal">undefined</span></span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">for</span>(<span class="keyword">let</span> i <span class="keyword">in</span> a)&#123;</span><br><span class="line">  <span class="variable language_">console</span>.<span class="title function_">log</span>(i) <span class="comment">// a b d e</span></span><br><span class="line">  <span class="variable language_">console</span>.<span class="title function_">log</span>(a[i])<span class="comment">// 1 2 null undefine</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<blockquote>
<p>注意这个遍历时的i为<strong>键</strong>而非值</p>
</blockquote>
<h4 id="for…of"><a href="#for…of" class="headerlink" title="for…of"></a>for…of</h4><p>for…of是用来遍历可迭代对象的所有元素，对于像上面的那个例子中的a进行for…of迭代则会报错</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> str = <span class="string">&#x27;bar&#x27;</span>;</span><br><span class="line"><span class="keyword">for</span>(<span class="keyword">const</span> i <span class="keyword">in</span> str)&#123;</span><br><span class="line">  <span class="variable language_">console</span>.<span class="title function_">log</span>(i);<span class="comment">//0 1 2</span></span><br><span class="line">  <span class="variable language_">console</span>.<span class="title function_">log</span>(str[i]);<span class="comment">// b a r</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<blockquote>
<p>注意这个遍历时的i为<strong>键</strong>而非值</p>
</blockquote>
<h3 id="js哪些方法会改变原数组-原字符串"><a href="#js哪些方法会改变原数组-原字符串" class="headerlink" title="js哪些方法会改变原数组/原字符串"></a>js哪些方法会改变原数组/原字符串</h3><p>除非重新设置引用，没有方法可以改变原字符串，可以改变原数组的有如下</p>
<ol>
<li>sort（）；改变数组</li>
<li>reverse（）：改变数组</li>
<li>pop（）；弹出元素</li>
<li>push（）；插入位置</li>
<li>shift（）；弹出元素</li>
<li>unshift（）；插入位置</li>
<li>splice（）；删除再插入元素</li>
</ol>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/page/tags/%E7%AC%94%E8%AF%95%E9%A2%98/" rel="tag"># 笔试题</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/page/2020/09/10/ES5%E4%B8%AD%E7%9A%84%E6%9E%84%E9%80%A0%E5%87%BD%E6%95%B0%E5%88%9B%E5%BB%BA%E5%AF%B9%E8%B1%A1%E5%92%8C%E7%B1%BB%E7%9A%84%E7%BB%A7%E6%89%BF%E6%96%B9%E6%B3%95%E3%80%81%E5%8E%9F%E5%9E%8B%E9%93%BE/" rel="prev" title="ES5中的构造函数创建对象和类的继承方法、原型链">
                  <i class="fa fa-chevron-left"></i> ES5中的构造函数创建对象和类的继承方法、原型链
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/page/2020/09/18/Vue3%E6%96%B0%E5%86%85%E5%AE%B9-1/" rel="next" title="Vue3新内容-1">
                  Vue3新内容-1 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    <div class="comments utterances-container"></div>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">爱爱爱呵风他</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script size="300" alpha="0.6" zIndex="-1" src="https://cdn.jsdelivr.net/npm/ribbon.js@1.0.2/dist/ribbon.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/page/js/comments.js"></script><script src="/page/js/utils.js"></script><script src="/page/js/motion.js"></script><script src="/page/js/next-boot.js"></script>

  
<script src="https://cdn.jsdelivr.net/npm/hexo-generator-searchdb@1.4.0/dist/search.js" integrity="sha256-vXZMYLEqsROAXkEw93GGIvaB2ab+QW6w3+1ahD9nXXA=" crossorigin="anonymous"></script>
<script src="/page/js/third-party/search/local-search.js"></script>





  




<script class="next-config" data-name="utterances" type="application/json">{"enable":true,"repo":"assd12138/utterancesComment","issue_term":"pathname","theme":"preferred-color-scheme"}</script>
<script src="/page/js/third-party/comments/utterances.js"></script>

</body>
</html>
